package com.hsmpay.mobile.dao.organization.impl;

import com.hsmpay.common.dao.Impl.BaseDaoSupport;
import com.hsmpay.mobile.dao.organization.OrganizationDao;
import com.hsmpay.mobile.pojo.organization.Organization;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;

/**
 * 机构dao 实现类  organizationDao
 * @author 颜铃璋
 * 创建时间: 2012-11-23
 * @param <Entity>
 * @param <Query>
 */
@Repository("organizationDao")
public class OrganizationDaoImpl<Entity extends Serializable,Query extends Object> extends BaseDaoSupport<Entity,Query> implements OrganizationDao<Entity,Query> {

	/**
	 * 获取子节点
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public List<Organization> searchSonList(Long parentId) throws Exception{
		return (List)getSqlMapClient().queryForList("organizationSqlMap.searchSonList", parentId);
	}

	/**
	 * 根据Id 查询机构   包括删除的 和没有审核通过的
	 * @param id
	 * @return
	 * @throws SQLException
	 */
	public Organization searchOrganizationAllById(Long id) throws SQLException{
		return (Organization) getSqlMapClientTemplate().queryForObject("organizationSqlMap.searchOrganizationAllById",id);
	}

}
